#ifndef platform_h__
#define platform_h__

#ifdef _WIN32
#   define WIN32_LEAN_AND_MEAN
#   include <windows.h>
#   include <winsock.h>
#else   // for linux
#   include <sys/types.h>
#   include <sys/socket.h>
#   icnlude <netinet/in.h>
#   include <unistd.h>
#endif // _WIN32

// usefull macros for platform
#ifdef _WIN32
#   define close_socket(s) closesocket(s)
#   define platform_sockets_startup() WSADATA	data;   \
    if(WSAStartup(MAKEWORD(2, 2), &data) != 0)          \
	{                                                   \
		fwprintf(stderr, L"WSAStartup failed\n");       \
		exit(EXIT_FAILURE);                             \
	}

#   define platform_sockets_shutdown() if(WSACleanup() != 0)\
	{                                                       \
		fwprintf(stderr, L"WSAStartup failed\n");           \
		exit(EXIT_FAILURE);                                 \
	}
#else
#   define close_socket(s) close(s)
#   define platform_sockets_startup()
#   define platform_sockets_shutdown()
#endif

#endif // platform_h__
